#include<vector>
#include<iostream>
using namespace std;

int main()
{
 vector<int>v;
 vector<int>counts;
 vector<int>numbers;
 int j;
 
 while (1)
 {
  cout<<"ch "<<endl;
  cin>>j;
  if (j==0)break;
  v.push_back(j);
 }
for (int i=0; i<v.size();i++)
{
 int a=-1;
  for (int q=0; q<numbers.size(); q++)
   {
    if (v[i]==numbers[q])
    a=q;
   }
   if (a==-1)
    {  
      numbers.push_back(v[i]);
      counts.push_back(1);
    }
 else 
   counts[a]+=1;

}
for (int q=0; q<numbers.size(); q++)
 {
  cout<<numbers[q]<<" "<<counts[q]<<'\n';
 }
return 0;
}

